import React from 'react';
import { Redirect, Route, Switch } from 'react-router-dom';
import  Home from '../pages/home/Home';
import Category from '../pages/category/Category';
import Detail from '../pages/home/Detail';
import NotFound from '../pages/common/NotFound'
export default function PageRouter() {
  return (
      <Switch>
        <Route path="/home" component={Home} exact />
        <Route path="/home/detail/:id" component={Detail} />
        <Route path="/category" component={Category} />
        {/* 如果根目录跳到home,什么都匹配不到显示404 */}
        <Redirect from='/' to="/home" exact />
        <Route path="*" component={NotFound} />
      </Switch>
  )
}
